// common functions used in webPanel

/**
 * listClear(listName)
 *
 * Clear all itens from list given list box
 *
 * listName
 *	name of list box to be cleared
 *
 */
function listClear(listName)
{
	document.getElementById(listName).suppressonselect = true;
	while (document.getElementById(listName).getRowCount() != 0)
		document.getElementById(listName).removeItemAt(0);
	document.getElementById(listName).suppressonselect = false;
}

/**
 * disable_ctrls
 *
 * disables all objects on current window
 *
 */
function disable_ctrls()
{
	// Disable buttons
	var objs=document.getElementsByTagName("button");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=1;

	// Disable listbox
	var objs=document.getElementsByTagName("listbox");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=1;

	// Disable input
	var objs=document.getElementsByTagName("input");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=1;

	// Disable menulist
	var objs=document.getElementsByTagName("menulist");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=1;
}

/**
 * enable_ctrls
 *
 * enables all objects on current window
 *
 */
function enable_ctrls()
{
	// Disable buttons
	var objs=document.getElementsByTagName("button");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=0;

	// Disable listbox
	var objs=document.getElementsByTagName("listbox");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=0;

	// Disable input
	var objs=document.getElementsByTagName("input");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=0;

	// Disable menulist
	var objs=document.getElementsByTagName("menulist");
	for (var i=0; i<objs.length; i++)
		objs[i].disabled=0;
}

